package com.hsgene.user.controller;

import com.hsgene.common.util.result.ApiResult;
import com.hsgene.common.util.web.session.UserInfo;
import com.hsgene.user.service.LoginCheckService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 登录校验Controller
 *
 * @author wangbing
 * @version 1.0, 2018/7/19
 */
@RestController
@RequestMapping("/1.0/genetic/testing/checking")
public class GeneticLoginCheckController {

    @Resource
    private LoginCheckService loginCheckService;

    /**
     * 用户登录状态校验
     *
     * @param sessionId   会话标识
     * @param accessToken 访问令牌
     * @return 校验结果
     */
    @GetMapping("login/status")
    public ApiResult<UserInfo> checkLoginStatus(
            @RequestParam(name = "sessionId", required = false) String sessionId,
            @RequestParam(name = "accessToken", required = false) String accessToken) {
        return loginCheckService.checkLoginStatus(sessionId, accessToken);
    }
}
